<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
<input type="text" name="city">
<button>查询</button>
<script>
    var btn = document.getElementsByTagName('button')[0];
    var city = document.getElementsByName('city')[0];
    btn.onclick = function ()
    {
        var xhr = new XMLHttpRequest();
        xhr.open('get' , 'http://www.1808-test.com/1.php' );

        xhr.send();
        xhr.onreadystatechange = function ()
        {
            if (xhr.readyState == 4 && xhr.status == 200)
            {
                console.log(xhr.responseText)
                // var res = JSON.parse(xhr.responseText)
                // console.log(res.result.today)
            }
        }
    }
</script>
</body>
</html>

